ARexx script run before rendering


This script is run before each image is rendered.

It is also called for the first image (for warps and morphs) and for the last image (for morphs). By default the first and last frames are not rendered. Produce will need to be set to 1 to output these frames. This allows the first and last frames to be converted to the same format as the other output images.

It is passed one parameter - Base - the address of a structure which contains the following:

Frame       = 0  : The current frame number, starting at 1 (0 for 1st frame) - read only.
TotalFrames = 1  : The total number of frames being rendered - read only.
Single      = 2  : Set to 1 if a Warp, 0 = Morph, 2 = Anim Morph, 3 = Anim Warp - read only.
Movement    = 3  : 0 to 1024 - the proportion of movement from first to second image.
Red1        = 4  : 0 to 1024 - the proportion of Image 1 Red to use.
Green1      = 5  : As Red1 for Green.
Blue1       = 6  : As Red1 for Blue.
Red2        = 7  : 0 to 1024 - the proportion of Image 2 Red to use.
Green2      = 8  : As Red2 for Green.
Blue2       = 9  : As Red2 for Blue.
Produce     = 10 : Set to 0 to not render this frame, 1 otherwise.
RPlus       = 11 : 0 to 255 to add to Red in rendered image.
GPlus       = 12 : As RPlus for Green.
BPlus       = 13 : As RPlus for Blue.
RMinus      = 14 : 0 to 255 to subtract from Red in rendered image.
GMinus      = 15 : As RMinus for Green.
BMinus      = 16 : As RMinus for Blue.
DX          = 17 : 0 to ? - X amount to skip - parameters .
DY          = 18 : 0 to ? - Y amount to skip - parameters .
Start       = 19 : Starting frame number.

The values of these parameters may be set and read using the GetValue and StoreValue functions:

/* To read the value of e.g. Movement use:
   integer_variable = GetValue(Base,Movement)
*/

/* To set the value of e.g. Produce to 0 use:
   call StoreValue(Base,Produce,0)
*/

GetValue:Procedure
   Parse arg XBase, XAdd
   return C2D(IMPORT(D2C(STRIP(XBase) + (STRIP(Xadd) * 4)),4))

StoreValue:Procedure
   Parse arg XBase, XAdd, XVal
   call EXPORT(D2C(STRIP(XBase) + (STRIP(Xadd) * 4)),RIGHT(D2C(XVal),4,D2C(0)),4)
   return

The default values passed to the script for modification are:

Movement            : (1024 * Frame)/(TotalFrames + 1) Morphs
                      (1024 * Frame)/TotalFrames       Warps

Red1,Green1,Blue1   : Movement                         Morphs
                      1024                             Warps

Red2,Green2,Blue2   : (1024 - Movement)                Morphs
                      0                 Irrelevant for Warps

Produce             : 1                                Rendered frames
                      0                 Frames 0 and TotalFrames+1
RPlus,GPlus,BPlus   : 0
RMinus,GMinus,BMinus: 0
DX,DY               : Initially set by DX  and DY  parameters

Changing these values allows acceleration of movement, colour fades etc. and the generation of only some images (to check a long animation).

Example scripts included are:

FadeToBlack.TSM - Warp fade to black

FadeToWhite.TSM - Warp fade to white

PixelMorph.TSM - Morph by pixelating

PixelWarp.TSM - Warp pixelating

PreAll.TSM - Render all images

Prescript.TSM - Do nothing example